function jurisdiction(val) {
    //   console.log('你点击了权限分配');
    this.roleTree = [];
    this.role.roleCode = val;
    const par = {
        roleCode: val
    }
    RoleJurisdiction(par).then(res => {
        if (res.data.code === 200) {
            console.log(res.data.data);
            this.roleJurisdiction = res.data.data;
            this.getTreeKey(this.roleJurisdiction, this.roleTree)
            this.rolejurisdictionDialog = true
        } else {
            this.$message.error(res.data.message)
        }
    });

}


//采用递归的形式获取当前角色所有权限下的id
// 同时将得到的节点保存到数组roleTree中
function getTreeKey(node, array) {
    // if(!node.children){
    //       return array.push(node.id)
    // }
    // node.children.forEach(item=>{
    //     this.getTreeKey(item,array)
    // })
    for (let i = 0; i < node.length; i++) {
        let item = node[i];
        if (item.children != null && item.children.length > 0) {
            this.getTreeKey(item.children, array);
        } else {
            if (item.roleCode != null) {
                // item.roleCode = item.id
                console.log('....=', item.id);
                array.push(item.id);
            }
        }
    }
}
// 权限分配弹框中的确定按钮
function treeBtn() {
    const treeArray = [
        ...this.$refs.treeRef.getCheckedKeys(),
        ...this.$refs.treeRef.getHalfCheckedKeys()
    ]
    console.log('treeArray', treeArray);
    this.roleTree = treeArray;
    var para = {
        roleCode: this.role.roleCode,
        juriIds: this.roleTree.toString()
    };
    console.log('这是传过来的 roleCode=', para.roleCode);
    console.log('这是传过来的juriIds=', para.juriIds);
    getRoleAllocation(para).then(res => {
        if (res.data.code === 200) {
            console.log('成功');
            console.log(res.data);
            this.$message.success('成功1111');
            this.rolejurisdictionDialog = false;

        }
    });

}